var canvasDom = document.createElement("canvas")
document.body.append(canvasDom);
canvasDom.width = canvasDom.height = document.body.clientWidth;
// canvasDom.height = 576 * 5;
var context = canvasDom.getContext("2d");
var imgdata = context.getImageData(0, 0, canvasDom.width, canvasDom.height)
var { Point } = require("../Point")

var w = canvasDom.width;
var h = canvasDom.height;

function test1() {
	var data = imgdata.data;
	for (let index = 0, len = data.length / 4; index < len; index++) {
		var w0 = index % w;
		var h0 = (index - w0) / w;
		var direct1 = (Math.sin(w0 / w * Math.PI * 2) + 1) / 2 * 255;

		var direct2 = (Math.sin(h0 / w * Math.PI * 2) + 1) / 2 * 255;

		data[index * 4] = direct2;
		data[index * 4 + 1] = 0;
		data[index * 4 + 2] = direct1;
		data[index * 4 + 3] = 255;
		if (w0 == 1) {
			console.log(direct1)
		}
	}
	context.putImageData(imgdata, 0, 0)
}
test1()
// (Math.sin(0-Math.PI/2)+1)/2
// todo （渐变方向 组合）